﻿@using Compass.Wasm.Shared.Projects
@inject NavigationManager NavigationManager
@inject IJSRuntime JsRuntime
<tr>
    <td>
        <CompBatch Batch="DrawingDto.Batch" />
    </td>
    <td>
        <CompUpdateIcon Roles="admin,pm,mgr,dsr" Url="@($"drawing/update/{DrawingDto.Id}")" />
        @DrawingDto.ItemNumber
    </td>
    <td>
        <CompPdfFiles Roles="admin,pm,mgr,dsr" PdfUrls="@DrawingDto.DrawingUrl" UploadUrl="@($"drawing/update/{DrawingDto.Id}")" />
    </td>
    <td>
        <span @onclick="Show" hidden="@(string.IsNullOrWhiteSpace(DrawingDto.ImageUrl))">@(showImage ? "▲" : "▼")</span>
    </td>
</tr>
@if (showImage)
{
    <tr>
        <td colspan="3">
            <img src="@DrawingDto.ImageUrl" asp-append-version="true" height="300px" />
        </td>
    </tr>
}
@code {
    [Parameter]
    public DrawingDto DrawingDto { get; set; }
    private bool showImage = false;
    private void Show()
    {
        showImage = !showImage;
    }
}
